<?php 
// 打印
function p($data)
{
	echo "<pre>".print_r($data,true)."</pre>";
}
//自动加载
function __autoload($classname)
{
	if (substr($classname, -10)=='Controller' && require_array(
			array(
				MODEL_PATH.'Controller/'.$classname.'.class.php',
				)
		)) {}else
	if (substr($classname, -5)=='Model' && require_array(
			array(
				MODEL_PATH.'Model/'.$classname.'.class.php',
				EAZYPHP_PATH.'Model.class.php',
				)
		)) {}else{
		$path=EAZYPHP_PATH.'Tool/'.$classname.'.class.php';
		require $path;
	}

}


function require_array($data)
{
	foreach ($data as $f) {
		if(is_file($f)){
			require $f;
			return true;
		} 
	}
}

//配置项
function C($name=null,$value=null)
{
	static $config=array();
	if(is_null($name)){//读取配置项
		return $config;
	}else if (is_array($name)) {//批量设置配置项
		$config=array_merge($config,$name);
	}else if (is_null($value)) {//读取一个配置项
		return isset($config[$name])?$config[$name]:null;
	}else{//修改一个配置项
		$config[$name]=$value;
	}
}

//打印用户定义常量
function print_const()
{
	$const=get_defined_constants(true);
	p($const['user']);
}

 ?>